package question1.wrong;

import java.util.List;

public class Worker implements Runnable {

    private int workerId;

    private List<Task> taskList;

    public Worker(int workerId, List<Task> taskList) {
        this.workerId = workerId;
        this.taskList = taskList;
    }

    @Override
    public void run() {
        while (!taskList.isEmpty()) {
            Task task = taskList.remove(0);
            task.doTask(this);
        }
    }


    public int getWorkerId() {
        return workerId;
    }

    public void setWorkerId(int workerId) {
        this.workerId = workerId;
    }

    public List<Task> getTaskList() {
        return taskList;
    }

    public void setTaskList(List<Task> taskList) {
        this.taskList = taskList;
    }
}
